<?php
	class users extends database{
		protected $_table = "tbl_users";
		public function listusers(){
			$sql = "select * from $this->_table";
			$this->query($sql);
			return $this->fetchAll();
		}
		public function checkname($name){
			$sql = "select * from ".$this->_table." where user_name = '$name'";
			$this->query($sql);
			if($this->num_rows() > 0){
				return "false";
			}else{
				return "true";
			}
		}
		public function checkmail($mail){
			$sql = "select * from $this->_table where user_email = '$mail'";
			$this->query($sql);
			if($this->num_rows() > 0){
				return "false";
			}else{
				return "true";
			}
		}
		public function add($name,$pass,$fullname,$gender,$phone,$email,$level){
			$sql = "insert into tbl_users(user_name,user_pass,user_fullname,user_gender,user_phone,user_email,user_level) values('$name','$pass','$fullname','$gender','$phone','$email','$level')";
			$this->query($sql);
		}
	}
?>